function X = shave(X, border, shift)
if length(border) == 1
    border = [border border];
end
if nargin < 3, shift = 0; end

X = X(1+border(1)-shift : end-border(1)-shift, 1+border(2)-shift:end-border(2)-shift, :, :);
% X = X(1+border(1)-1:end-border(1)-1, 1+border(2)-1:end-border(2)-1, :, :);
